import { Logger } from "@/utils/logger";

class Processor {

    static bootinit(flag: Flag) {
        return bot`bootstrap init ${flag.pos.roomName}`;
    }

}

const processFunc: Record<string, (flag: Flag) => any> = {
    'bootinit': Processor.bootinit,
}

export const executeFlagCommands = () => {
    const processor = new Processor;
    Object.keys(Game.flags).forEach(flagName => {
        const flag = Game.flags[flagName];
        if (flag.color === COLOR_PURPLE) {
            const func = processFunc[flagName];
            if (func) {
                let result = func(flag);
                if (result !== undefined) {
                    Logger.info(`(Flag ${flagName}) "${result}"`, 'flag');
                }
                flag.remove();
            }
        }
    });
}